package org.s170.servlet.HouTaiServlet;

import org.s170.dao.UserInfoDao;
import org.s170.entity.UserInfo;
import org.s170.servlet.BaseServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/api/userInfo/list")
public class UserListServlet extends BaseServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Integer page = Integer.parseInt(req.getParameter("page"));
        Integer limit = Integer.parseInt(req.getParameter("limit"));

        String usernames=req.getParameter("username");
        UserInfo userInfo=new UserInfo();
        userInfo.setUsername(usernames);

        UserInfoDao dao=new UserInfoDao();
        List<UserInfo> list=dao.queryUserByPage(userInfo,page,limit);
        Long count=dao.queryUserByPageCount(userInfo);

        print(resp,pageVO(count,list));
    }
}
